package com.example.demo.utils;

import com.alibaba.fastjson.JSON;
import net.sf.json.JSONArray;
import org.openqa.selenium.Cookie;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.io.*;
import java.util.*;
import java.util.concurrent.TimeUnit;

public class WangyiUtils {
    public static Set<Cookie> cookies;

    public static void baocun(Set<Cookie> cookies) throws Exception {
        ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream("D:\\cookie\\wangyi.txt"));
        objectOutputStream.writeObject(cookies);
    }

    public static Set<Cookie> read() throws Exception {
        ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("D:\\cookie\\wangyi.txt"));
        HashSet<Cookie> cookies = (HashSet<Cookie>) objectInputStream.readObject();
        return cookies;
    }

}
